//index.js
//获取应用实例
// 子页面js加入: $ = app.globalData.$
var app = getApp(), $ = app.globalData.$;
Page({
  data: {
  },
  onLoad: function () {
    // 在当前页面onLoad函数中初始化jwxa
    $.jwxa(this);
  },
  loadGetJSON: function () {
    $.get('https://www.bilibili.com/index/ranking-3day.json', function (res) {
      console.log("$.get json result: ");
      console.log(res);
    });
  },
  loadGetHTML: function () {
    $.get('https://www.oschina.net/action/ajax/get_more_news_list?newsType=industry&p=2', function (res) {
      console.log("$.get html result: ");
      console.log(res);
    }, 'html');
  },
  loadPost: function () {
    var data = {newsType: 'industry', p: 3};
    $.post('https://www.oschina.net/action/ajax/get_more_news_list', data, function (res) {
      console.log("$.post result: ");
      console.log(res);
    });
  },
  setDataObjA: function () {
    // 设置objA
    $.data('objA', '111');
    // objA = 111
    console.log(this.data.objA);
  },
  setDataObjB_ObjC: function () {
    // 设置objB.objC
    $.data('objB.objC', 'aaa');
    // Object {objC: "aaa"}
    console.log(this.data.objB);
    // 设置objB.objD
    $.data('objB.objD', 'ddd');
    // Object {objC: "aaa", objD: "ddd"}
    console.log(this.data.objB);
  }
})
